Skip to content

Feat/add common labels#62

Open
ANIRUDH-333 wants to merge 1 commit into
guacsec:mainfrom
shreyasHpandya:feat/add-commonLabels
Open

Feat/add common labels#62
ANIRUDH-333 wants to merge 1 commit into
guacsec:mainfrom
shreyasHpandya:feat/add-commonLabels

Conversation

@ANIRUDH-333

@ANIRUDH-333 ANIRUDH-333 commented Mar 11, 2025

Copy link
Copy Markdown
Contributor

Contribution towards adding custom labels to all the guac resources

@roguepikachu roguepikachu force-pushed the feat/add-commonLabels branch from e801618 to 5d58f04 Compare March 12, 2025 06:45
- Adds support for custom global labels for guac stack
- Adds tests for custom labels

Signed-off-by: Gagan H R <ghr@guidewire.com>
Co-Authored-By: Anirudh Edpuganti <68942952+ANIRUDH-333@users.noreply.github.com>
Co-Authored-By: Ayush Shyam Kumar <65535504+ayush-shyam-kumar@users.noreply.github.com>
Co-Authored-By: shreyas pandya <1439158+shreyasHpandya@users.noreply.github.com>
@roguepikachu roguepikachu force-pushed the feat/add-commonLabels branch from 5d58f04 to e769232 Compare March 12, 2025 06:48
@funnelfiasco

Copy link
Copy Markdown
Contributor

From @ANIRUDH-333 in Slack:

The main reason for adding support for custom labels in the GUAC Helm charts is to provide users with the flexibility to include labels that align with their organization's standards and requirements. In our case, when deploying the GUAC stack, we have certain organizational policies that require specific labels on all Kubernetes resources. Currently, we achieve this through patching, but having built-in support for custom labels would make this process more seamless and maintainable.

@sunnyyip

sunnyyip commented Mar 17, 2025

Copy link
Copy Markdown
Contributor

Thanks @ANIRUDH-333 for the PR.

The guac.labels helper function was intended for your use case and it should be included in all resources - https://github.com/kusaridev/helm-charts/blob/main/charts/guac/templates/_helpers.tpl#L38-L48

api-only-ingress.yaml:15:{{- include "guac.labels" . | nindent 4 }}
guacrest-service.yaml:11: {{- include "guac.labels" . | nindent 4 }}
ingestor-sa.yaml:15: {{- include "guac.labels" . | nindent 4 }}
oci-collector-deployment.yaml:14: {{- include "guac.labels" . | nindent 4 }}
guacrest-sa.yaml:15: {{- include "guac.labels" . | nindent 4 }}
cd-certifier-sa.yaml:15: {{- include "guac.labels" . | nindent 4 }}
graphql-server-deployment.yaml:14: {{- include "guac.labels" . | nindent 4 }}
ingestor-deployment.yaml:14: {{- include "guac.labels" . | nindent 4 }}
ingress.yaml:15:{{- include "guac.labels" . | nindent 4 }}
collectsub-deployment.yaml:14: {{- include "guac.labels" . | nindent 4 }}
depsdev-collector-deployment.yaml:14: {{- include "guac.labels" . | nindent 4 }}
guacrest-deployment.yaml:14: {{- include "guac.labels" . | nindent 4 }}
depsdev-collector-sa.yaml:15: {{- include "guac.labels" . | nindent 4 }}
collectsub-service.yaml:10: labels: {{- include "guac.labels" . | nindent 4 }}
oci-collector-sa.yaml:15: {{- include "guac.labels" . | nindent 4 }}
collectsub-sa.yaml:15: {{- include "guac.labels" . | nindent 4 }}
visualizer-deployment.yaml:14: {{- include "guac.labels" . | nindent 4 }}
ingest-guac-data-job.yaml:10: {{- include "guac.labels" . | nindent 4 }}
ingest-guac-data-job.yaml:20: {{- include "guac.labels" . | nindent 8 }}
graphql-server-service.yaml:11: {{- include "guac.labels" . | nindent 4 }}
graphql-server-service.yaml:36: {{- include "guac.labels" . | nindent 4 }}
osv-certifier-deployment.yaml:14: {{- include "guac.labels" . | nindent 4 }}
graphql-server-sa.yaml:15: {{- include "guac.labels" . | nindent 4 }}
osv-certifier-sa.yaml:15: {{- include "guac.labels" . | nindent 4 }}
visualizer-service.yaml:10: labels: {{- include "guac.labels" . | nindent 4 }}
cd-certifier-deployment.yaml:14: {{- include "guac.labels" . | nindent 4 }}

Perhaps move your guac.customLabels into guac.common.labels and drop a conditional and reference in guac.labels?
i.e.

{{/*
Common labels
*/}}
{{- define "guac.labels" -}}
helm.sh/chart: {{ include "guac.chart" . }}
{{ include "guac.selectorLabels" . }}

{{- if guac.common.labels }}
{{ include "guac.common.labels" . }}
{{- end }}

{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

@shreyasHpandya

Copy link
Copy Markdown
Contributor

Thanks, @sunnyyip, this is a better approach, we will try to make these changes and update the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants